home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / util / rexx / upd130.lha / Upd / upd.doc < prev    next >
Text File  |  1993-04-11  |  16KB  |  429 lines

  1. Release 1.30
  2.  
  3.         The minimal player daemon - upd
  4.         ===============================
  5.  
  6.    © 1991-1993 Jonas Petersson & Absolut Software (aka Sirius Soft)
  7.  
  8.  
  9.  
  10. Introduction:
  11. =============
  12.  
  13. Wouldn't it be nice to have a process hanging around to play any
  14. sound file for you on demand instead of you having to do all this
  15. mucking about with audio.device etc? But it really has to be small
  16. and it HAS to be able to play my very large samples anytime...
  17. I must be able to call it simply from anywhere - even from scripts!
  18.  
  19. Tricky, but it can be done.
  20.  
  21. As a feature you can register you favourite sounds in a configuration
  22. file and well behaved programs will use the ones you like right now.
  23. It also has Arexx support - to be truely honest, that the ONLY way to
  24. use it... As of 1.01, there is also a fade option.
  25.  
  26. Actually, "minimal" is not quite true anymore as speech is available
  27. starting 1.20... As a spin-off of this you also get a "say" program
  28. that can play phonemes.
  29.  
  30. 1.30 includes a way to preload the samples from disk.
  31.  
  32. Current version works rather well along the way I intended.
  33.  
  34.  
  35. Changes:
  36. ========
  37.  
  38. Since 1.20 only two things have changed:
  39. 1) There is a version string.
  40. 2) Enforcer wont complain about a read to address 0 (command line
  41. parsing lookahead is a bit more clever now). This was completely
  42. harmless, but nevertheless a bug.
  43.  
  44. However, quite a number of people seems to have the prerelease 1.20
  45. that happened to be distributed with ToolManager2.0 and therefore
  46. the options after say and phoneme would not work unless they were
  47. in an ID string. This is the main reason for the 1.25 release.
  48.  
  49. Since a lot of you didn't see 1.25, I'll just tell you that the only
  50. difference between 1.25 and 1.30 is the -M option.
  51.  
  52. Usage:
  53. ======
  54.  
  55.     [run] upd [-bBUFSIZE] [-fIDFILE] [-pPRIORITY] [-M]
  56.  
  57. The "run" is of course optional, but daemons really should be in the
  58. background unless you want the see the debugging information.  "bufsize"
  59. is the amount of chip memory that each of the four buffers will use
  60. while playing.  (These are allocated at start to make sure you will be
  61. able to play anytime - as long as you can get hold of the audio
  62. channels...).  Default is 1024 and specifying less than 64 will give you
  63. the default. (I've heard that some people can't ever get anything good
  64. out with less than a 1K buffer - am I really the only one with a quick
  65. enough HD/SCSI interface?) 
  66.  
  67. NOTE: Don't make the buffer bigger than you actually need - a large
  68. buffer also means that the sample will start a little bit later since
  69. more information must be loaded before it can begin!
  70.  
  71. If the IDfile parameter exists, it will be used instead of the
  72. default s:upd.IDs. 
  73.  
  74. As of 1.20 I've also added the priority option to satisfy some requests
  75. from people who prefer their sound to be perfect before getting things
  76. done... You people may specify -p35 or something like that along with
  77. some huge buffer. Of course, you can also lower priority with this option.
  78.  
  79. As of 1.30, the -M option can be used to waste your RAM! If present at
  80. startup, upd will always try to find a memory space to load the sample
  81. into before playing it. If that fails the sample will play from disk
  82. as before. This will of course delay the sound a bit as well. For small
  83. samples there is hardly any difference, for medium size samples there
  84. is a delay but no access to the disk while playing, and for large samples
  85. things are just like before. (I don't use this option myself...)
  86.  
  87. The above won't produce any sound as you probably realise.  Once run, the
  88. only way to talk to upd is with Arexx - I even removed the BREAK stuff
  89. that was in it for Zound, since Arexx could hang around waiting for a
  90. reply forever when you interupted the sound that way. The break will
  91. "wait" until the daemon is idle next time.
  92.  
  93. upd currently knows of these commands:
  94.  
  95.     file filepath [options] [anotherfilepath [options]]
  96.     id   id-in-s:upd.IDs
  97.         rescan new-id-file
  98.     fade #-of-steps-per-bufsize
  99.     say string-to-translate-and-say
  100.     phoneme phoneme-string-to-say
  101.     exit
  102.  
  103. The 'fade' command is new to 1.01 and might need some explanation:
  104. What is does is merely reconfigure upd for future requests. By default
  105. fade is set to 0 which means that any playing sound will be cut off
  106. as soon as a new AREXX command arrives. Any other number indicates that
  107. when a new request arrives, first fade out the current sound by lowering
  108. the volume by the specified amount by each played buffer until volume reaches
  109. zero. As the observant reader realises, a value exceeding 64 will do 
  110. the same thing as 0 and a negative value may give nondesired effects...
  111.  
  112. 'say' and 'phoneme' are new as of 1.20 and their use should be obvious.
  113. These are really just a spin-off from what was added to the ID file. 
  114. Speech currently won't fade - I fail to see the beauty in fading it...
  115.  
  116. Well, there is actually one more command: 'Can it, Marvin'. This will 
  117. silently interrupt the current sample. (To be truely honest, ANY command
  118. will interrupt a sample - if it's known, it will be used, otherwise the
  119. sound just stops). Be careful with the 'rescan' command: if there is a 
  120. problem reading the new file, you will have no IDs at all...
  121.  
  122. The options are the same as for Zound except for the -n option that doesn't
  123. exist here (tell me you need it and I'll fix that too... sigh). Here's the
  124. list:
  125.  
  126.     -r rate    How fast to play the sample. Default is what is in the
  127.         8SVX header or 310 if it's a raw file. This is usually
  128.         reasonable - most 'raw' samples I've come across are either
  129.         310 or 155. Lower numbers will play the sample faster.
  130.  
  131.     -v volume    Ranges between 0 and 64, 64 being max and default.
  132.  
  133.     -s start    Possible offset from the beginning. Default 0.
  134.  
  135.     -l length    Possible length unless you want it all. Default is
  136.         length of the sample. Be careful with these two, or
  137.         you might get undesired results.
  138.  
  139.     -c cycles    How many times to play each buffer. Default 1. Not
  140.         very useful, but you can get a nice "mouse" effect by
  141.         setting this to 2 and playing twice as fast...
  142.  
  143.     -d        Toggle debug information. Note that this will appear on
  144.         the standard output of the DAEMON, not where you called 
  145.         it from (that is, the ARexx script or wherever).
  146.  
  147.     -L        Play the sample in the left speaker only. If it's a stereo
  148.         sample only the left channel samples are used.
  149.     -R        Same as '-L' but for right speaker.
  150.     -S        Play in both speakers even if it's a mono sample.
  151.         Default for these three options are of course what is in the
  152.         8SVX header or -L if it's a raw sample.
  153.  
  154. Examples:
  155. =========
  156.  
  157. * Example of usage (from WShell etc):
  158.  
  159.     "address play file 'sounds:chopper'
  160.     "address play fade 2
  161.     "address play id 2001
  162.         "address play rescan 'ram:upd.IDs'
  163.     "address play exit
  164.  
  165.  
  166. * If you are using the vanilla 2.0 AREXX you might have to create a file
  167.   like this:
  168.  
  169.     /* A test script in AREXX */
  170.  
  171.     address PLAY say "Hi there!"
  172.  
  173.   Then execute it with 'rx filename.rexx'
  174.  
  175.   Alternatively, you can give a command like this (note the tick [']):
  176.  
  177.     rx 'address PLAY say "Hi there!"
  178.  
  179.  
  180. * Say "emulations":
  181.  
  182.     address play say "-f -r -s100 E T phone home."
  183.     address play phoneme "-s200 YUWNAEZ PEH1TERSUN"
  184.  
  185.  
  186. NOTE: Arexx normally converts everything to UPPERCASE and might try to
  187. do arithmetics etc on filenames which is why it's generally a good idea
  188. to 'singelquote' all paths, IDs etc. If you're looking for the port
  189. 'the hard way' to send your own message, the name is "PLAY" in uppercase.
  190.  
  191. NOTE2: If you are REALLY in a hurry to get rid of upd you could do this:
  192.  1) Send a any dummy Arexx message (this will stop the sound)
  193.  2) Send a break C to upd - break still works when upd is idle.
  194. or
  195.  A) Send the exit message.
  196.  
  197. The last might sound much easier than the first unless you (like me)
  198. have a trapped DisplayBeep() that 'pings' via upd.  In this case,
  199. producing a DisplayBeep() and a break C is much simpler.  The order is
  200. not relevant since the break is "queued". 
  201.  
  202.  
  203. Hints:
  204. ======
  205.  
  206. Running upd from your SOUNDS: directory is a nice way to get rid of having
  207. you type the FULL path everytime you want to play a sample. (The daemon
  208. has no simple way of knowing WHERE you were when you sent the message 
  209. (that I know of) and therefore assumes it to be in the current directory)
  210.  
  211.  
  212. Files:
  213. ======
  214.  
  215.     s:upd.IDs
  216.  
  217. This file contains the IDs of your favourite samples like a database
  218. the is easily editable. File format:
  219.  
  220.  
  221. # Lines starting with '#' are comments
  222. # Id list for micro player daemon
  223. # Created 910201 Jonas Petersson (zaphod@magrathea.indic.se)
  224. # These sounds could be called for at certain situations
  225. # On severe error
  226. BUG    sounds:explosion -S
  227. # When asked for confirmation
  228. CONFIRM sounds:PressLeftMouseButton -L
  229. # Minor trouble
  230. ERROR   sounds:ImSorryDaveImAfraidICantDoThat -R
  231. # Going down...
  232. GURU    sounds:RoysDeathMonologueFromBladerunner -S
  233. # Personal shortcuts/favourites
  234. 2001    sounds:openpod -L sounds:hal -R
  235. # These should always work:
  236. ET      -SAY -r -f -p100 -F20000 -s110 E T phone home.
  237. AUTHOR  -PHONEME YUWNAEZ PEH1TERSUN
  238. # These are for Arq
  239. warn_write_protected    -SAY I'm afraid I can't do that.
  240. warn_insert_volume      -SAY I can't see it.
  241. warn_delete             -SAY Oh no.
  242. warn_printer            -SAY Printer trouble.
  243. error_task_held         -SAY You are in deep shit.
  244. error_read_write        -SAY Bad disk.
  245. error_general           -SAY Error.
  246. warn_general            -SAY Warning.
  247. query_general           -SAY Please.
  248. beep                    -SAY Beep.
  249.  
  250.  
  251. -SAY and -PHONEME are special "files" as of 1.20. These instead trigger
  252. the use of translator/narrator since some people don't have a lot of
  253. samples around. Remember that everything is different here - options
  254. come BEFORE the string and have other meanings than for samples. I've
  255. tried to keep the the same as the command 'say' uses:
  256.  
  257.     -m/-f    Male/Female
  258.     -n/-r    Natural/Robot
  259.     -p###    Pitch
  260.     -v###    Volume
  261.     -s###    Speed (rate really)
  262.     -F###    Sample frequency
  263.  
  264.     (Defaults are the same as for "say")
  265.  
  266. Removing entries will of course result in no sound (upd might mourn about
  267. it on the standard output though, unless you redirect it). Remember that
  268. ARexx might convert to uppercase unless you quote!
  269.  
  270. Feel free to add whatever you like. Could be nice with some standard though.
  271. If you make a program that uses several ID's it would be a good idea to have
  272. the same prefix for instance. 
  273.  
  274. Suggestions are welcome. Mjl's Arq is an example of a program that uses
  275. this feature. Read Arq's docs for details. Another example program that 
  276. uses upd is ToolManager by Stefan Becker.
  277.  
  278. NOTE: It *IS* possible to have white space, lowercase etc in the IDs, but
  279. it might cause confusion if used. Be warned.
  280.  
  281. NOTE2: The file is scanned once when the program starts. If you make any
  282. changes to it, you'll have to restart the deamon or ask it to scan the file
  283. explicitly.
  284.  
  285.  
  286. Return codes:
  287. =============
  288.  
  289. If the Arexx command returns 20, the secondary result code gives the
  290. reason for the failure:
  291.  
  292. 10    Can't allocate channels.
  293. 17    Can't open s:upd.IDs on request to play by ID.
  294. 18    Requested ID not found.
  295. 19    Trouble reading new ID file.
  296. 20    Error during parse of options.
  297. 21    Can't open file with sample.
  298. 22    File is IFF, but not FORM 8SVX.
  299. 23    Bad IFF file.
  300. 24    Bad CHAN length.
  301. 25    Bad VHDR length.
  302. 26    Can't open file 2nd time. (For stereo possibility)
  303. 30    Can't play backwards. (Weird options)
  304. 31    Can't allocate IOAudio structs.
  305. 32    Can't open ports for channels.
  306. 47    Can't open the translator library.
  307. 48    Translator won't use that string.
  308. 50    Bad options to -SAY/-PHONEME in ID line.
  309. 51    Can't open the narrator device.
  310. 52    Couldn't Allocate talk Signal bit.
  311. 53    Narrator won't do that. Usually bad pitch etc.
  312.  
  313.  
  314.  
  315. Being interrupted to do something else is not considered a failure. Note
  316. that this is true even if the current message has not been parsed yet.
  317. That is if UPD is sent these two messages (in order):
  318.  
  319.     address PLAY phoneme "Hi there!"
  320.     address PLAY say "Hi there!"
  321.     
  322. It will not parse the first one since it knows there is another one
  323. waiting and therefore returns 0 (OK) for the first even though it
  324. contains invalid phonemes. This should hardly be a problem and you 
  325. hardly want it to work the other way since that might slow down things
  326. significantly when you have a lot of queued requests (likely when trapping
  327. DisplayBeep() for instance). [Note that putting the above two messages
  328. after each other in a script WONT send them at the same time since upd
  329. doesn't release the first message until it's done!]
  330.  
  331.  
  332. Future enhancements:
  333. ====================
  334.  
  335. Maybe automatic detach (didn't work well in Aztec 5.0a, and I havn't really
  336. tried with 5.0d yet).
  337.  
  338. Probably not very much else - this is a simple sound daemon for minor
  339. background purposes of helping simple programs do more than DisplayBeep().
  340. I'd like to think of it as a complement to SPEAK: - if you want more
  341. you probably want it interactive. (Hmm, that's a thought - a SOUND: device)
  342.  
  343.  
  344.  
  345. Problem history: 
  346. ================
  347.  
  348. 1. If your sample is on a floppy (or a very slow HD) there might be 
  349.    some sounds of silence when the playing rate exceeds the loading
  350.    rate... 
  351. Fix: You can now specify the amount of memory to be used by upd when you
  352.    start the daemon as in: 'upd -b2000'. But note that a larger buffer also
  353.    makes a longer delay until you hear the first part of the sound - it
  354.    doesn't start until it has filled the first buffer.
  355.  
  356. 2. Stereo and Fibonachi packed samples not yet supported (there are loading
  357.    problems - play them with 'Zound' instead for now).
  358. Fix: Stereo is OK now if you use the above size option (it actually worked
  359.    in RAM: before too - but I didn't enable it for the prerelease). As for 
  360.    Fibonachi: it's not too hard to fix, but I've never seen anyone using it -
  361.    is it worth the effort? If you happen to have a Fib-sample - PLEASE send it
  362.    to me - I don't have the patience to reconstruct one by hand...
  363.  
  364. 3. Could hang forever if someone stole the channel. 
  365. Fix: So, I didn't check everything in 0.99 - now I do (I hope... ;-)
  366.  
  367. 4. -s and -l weren't used in 0.99, now they are.
  368.  
  369. 5. On request from the UK CDTV developers, FADE was added as of 1.01
  370.  
  371. 6. On request from various people, added option -p## at startup to make
  372. it simpler to raise priority for those demanding perfect sound but are
  373. to lazy to use "ChangeTaskPri" for it...
  374.  
  375. 7. Added speech and better command line parsing as of 1.20.
  376.  
  377. 8. Options to say and phoneme DID work with 1.20, but a lot of people
  378.    got hold of the prerelease where it didn't work! 1.25 is a safe version.
  379.  
  380. 9. Up until v1.25 there was a harmless Enforcer hit at address 0 due to
  381.    sloppy command line parsing. 
  382.  
  383. 10. Due to the v1.20 prerelese confusion, there is now a version string!
  384.  
  385. 11. Due to some very stubborn users, there is from 1.30 an option '-M'
  386. for Memorywaste. If there is a big enough chunk of memory, the sample 
  387. is read into it before playing is started.
  388.  
  389. Thanks to mjl@alison.at for the idea.
  390.  
  391.  
  392. Distribution
  393. ============
  394.  
  395.   UPD is not public domain. A friend of mine advised me to call it
  396. "Freely Distributable Copyrighted" instead. That's close enough.  
  397. If you wish to include it with a commercial program feel free provided 
  398. that you send me a registered copy. And don't forget to mention me
  399. in the manual.
  400.  
  401.   As always, Fred Fish is free to include it in his library.
  402.  
  403.   Source code? You mean there is something to IMPROVE??? Right, send
  404. me a message then and I'll think about it...
  405.  
  406.  
  407.  
  408.  
  409.  
  410.     Jonas 'Zaphod' Petersson
  411.     Albrektsvagen 113A
  412.     S-603 53  Norrkoping
  413.     SWEDEN
  414.     Voice: +46 11 162517    Remember: I'm in Sweden - Timezone GMT+1!
  415.     Modem: +46 11 135317        magrathea (A1000) will let you leave
  416.                     a message for me if you log in as "guest".
  417.  
  418.     zaphod@magrathea.indic.se                   /* At home */
  419.     zap@indic.se                    /* At work  - Quickest */
  420.  
  421.  
  422. Feel free to send comments, bug reports (huh?), money, coke, beer...
  423. [Sorry, girls are no longer allowed as I'm married now!]
  424.  
  425. Just a "Hi, I liked your program" is as good as a few bucks - I wrote this
  426. because I needed it, not to make money out of it...
  427.  
  428.  
  429.